package com.heima.example1;

import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;

public class GetLocalIP {
    public static void main(String[] args) throws Exception {
        // 获取本地IP地址  scy-windows11/192.168.197.101
        // scy-windows11/192.168.190.1
        //scy-windows11/172.20.10.4
        InetAddress localHost = InetAddress.getLocalHost();

        System.out.println(Inet6Address.getLocalHost().getCanonicalHostName());

        System.out.println(localHost);

        getLocalHostName();
    }

    public static String getLocalHostName(){
        System.out.println("111");
        throw new RuntimeException("ss");
    }
}
